package top.csmcool.musicapi.enums;

import lombok.Data;

/**
 * 平台枚举类
 * @Description
 * @Author shizhe
 * @Date 2025/1/27
 */

public enum PlatformEnum {

    MIGU("咪咕音乐","migu"),
    KUWO("酷我音乐","kuwo"),
    KUGOU("酷狗音乐","kugou"),
    NETEASE("网易云音乐","netease"),
    NAVIDROME("navidrome音乐播放器","navidrome"),
    QQ("qq音乐","qq");
    private String name;

    private String code;

    PlatformEnum(String name, String code) {
        this.name = name;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public static PlatformEnum getPlatformByEnum(String code) {
        PlatformEnum[] values = values();
        for (PlatformEnum value : values) {
            if(value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}
